<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <title>用户管理</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <link href="../../css/mine.css" type="text/css" rel="stylesheet">

    <script type="text/javascript" src="/js/jquery.js"></script>

    <script type="text/javascript">
        $(function () {
            $("#dept").change(function () {
                var deptId = $(this).val()
                if (deptId == 0) {
                    alert("请选择部门")
                } else {
                    $.ajax({
                        url: "/getRole",
                        data: "deptId=" + deptId,
                        type: "POST",
                        dataType: "JSON",
                        success: function (result) {
                            $("#role")[0].length = 0
                            for (var i = 0; i < result.length; i++) {
                                $("#role")[0].add(new Option(result[i].rname, result[i].roleid))
                            }
                        },
                        error: function () {
                            alert("ajax失败回调函数！")
                        }

                    })
                }
            })
        })
    </script>
</head>

<body>

<div class="div_head">
            <span>
                <span style="float:left">当前位置是：-》资源管理》用户管理</span>
                <span style="float:right;margin-right: 8px;font-weight: bold">
                    <a style="text-decoration: none" href="list.jsp">【返回】</a>
                </span>
            </span>
</div>
<div></div>

<div style="font-size: 13px;margin: 10px 5px">
    <form action="/resource/demo2/updateUser" method="post">
        <input type="hidden" name="id" value="${employee1.id}">
        <table border="1" width="100%" class="table_a">
            <tr>
                <td width="120px;">用户编号<span style="color:red">*</span>：</td>
                <td><input readonly type="text" name="employeenum" value="${employee1.employeenum}"/></td>
            </tr>
            <tr>
                <td>登录账号<span style="color:red">*</span>：</td>
                <td>
                    <input type="text" name="loginname" value="${employee1.loginname}"/>
                </td>
            </tr>
            <tr>
                <td>用户姓名<span style="color:red">*</span>：</td>
                <td>
                    <input type="text" name="username" value="${employee1.username}"/></td>
            </tr>
            <tr>
                <td>密码<span style="color:red">*</span>：</td>
                <td>
                    <input type="text" name="loginpassword" value="${employee1.loginpassword}"/>
                </td>
            </tr>
            <tr>
                <td>所属部门<span style="color:red">*</span>：</td>
                <td>
                    <select id="dept" name="deptid">
                        <c:forEach items="${deptList}" var="dept">
                            <option value="${dept.deptid}"
                                    <c:if test="${dept.deptid==employee1.deptid}">selected</c:if>
                            >${dept.deptname}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <td>所属职位<span style="color:red">*</span>：</td>
                <td>

                    <select id="role" name="roleid">
                        <c:forEach items="#{roleList}" var="role">

                        <option value="${role.deptid}"
                                <c:if test="${role.deptid==employee1.deptid}">selected</c:if>
                        >${role.rname}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <td>身份证<span style="color:red">*</span>：</td>
                <td>
                    <input type="text" name="idcaid" value="${employee1.idcaid}"/>
                </td>
            </tr>
            <tr>
                <td>联系电话<span style="color:red">*</span>：</td>
                <td>
                    <input type="text" name="telphone" value="${employee1.telphone}"/>
                </td>
            </tr>
            <tr>
                <td>邮箱<span style="color:red">*</span>：</td>
                <td>
                    <input type="text" name="email" value="${employee1.email}"/>
                </td>
            </tr>
            <tr>
                <td>联系地址：</td>
                <td>
                    <input type="text" name="address" value="${employee1.address}"/>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" value="提交">
                    <input type="reset" value="清空">
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>